﻿@model GPS.ENTITYS.ViewModelSMONHOC
@using PagedList.Mvc;
@using GPS.Helpers;
@{
    ViewBag.Title = "Danh mục môn học";
}
<style type="text/css">
    .logo-wrap, .navbar-default, .footer-distributed {
        display: block;
    }

    .table-striped > tbody > tr:nth-child(odd) > td,
    tr.found {
        background-color: #DCFADC;
    }
</style>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>
@*<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>*@

<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Danh Mục Môn Học</h3>
    <div class="row">
        <div class="row">
            @using (Html.BeginForm("Index", "GPS_MonHoc", FormMethod.Get))
            {
                @*@Html.Hidden("IsEdit", 0)*@
                <div class="list-group">
                    <fieldset class="fs_body">
                        <legend class="head_title">Điều kiện tìm kiếm</legend>
                        <div class="row criteria_search">
                            <div class="row">
                                <div class="col-md-2 control-label">
                                    Mã môn học:
                                </div>
                                <div class="col-md-4">
                                    @Html.TextBoxFor(model => model.mMONHOC_MA, new { @class = "form-control" })
                                </div>
                                <div class="col-md-2 control-label">
                                    Số đăng ký:
                                </div>
                                <div class="col-md-4">
                                    @Html.TextBoxFor(model => model.mMONHOC_TEN, new { @class = "form-control" })
                                </div>
                            </div>
                            <div class="row margin-top-05">
                                <div class="col-md-2 control-label">
                                    Trạng thái:
                                </div>
                                <div class="col-md-4">
                                    @Html.DropDownListFor(model => model.mMONHOC_ACTIVE, new List<SelectListItem>
                                {
                                                    new SelectListItem() {Text = "--Lựa chọn--", Value=""},
                                                    new SelectListItem() {Text = "Không hiệu lực", Value="0"},
                                                    new SelectListItem() {Text = "Hiệu lực", Value="1"}
                                }, new { @class = "form-control" })
                                </div>
                            </div>
                        </div>
                        <div class="row margin-top-05 btn_search">
                            @if (ViewBag.checkuser == "40")
                            {
                                <div style="float: right; margin: 0 2px;">
                                    @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Create", "GPS_MonHoc", null, htmlAttributes: new { @class = "btn btn-warning btn-sm" })
                                </div>
                            }
                            <button type="submit" class="btn btn-warning btn-sm">
                                <span class="glyphicon glyphicon-search"></span> Tìm kiếm
                            </button>
                        </div>
                    </fieldset>
                </div>
            }
        </div>
        <div class="row">
            <fieldset class="fs_body">
                <legend class="head_title">Kết quả tìm kiếm</legend>
                <div class="row divbtnFielset">
                    <div style="float: right;">
                        <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label>
                    </div>
                </div>

                <div class="row" style="clear:both; padding: 5px 0;">
                    <table class="table table-hover table-bordered table-condensed table-striped">
                        <tr>
                            <th>
                                STT
                            </th>
                            <th>
                                Mã môn học
                            </th>
                            <th>
                                Tên môn học
                            </th>
                            <th>
                                Số VBPL
                            </th>
                            <th>
                                Trạng thái
                            </th>
                            <th>
                                Thao tác
                            </th>
                        </tr>
                        @{
                            if (Model.SearchResults != null)
                            {
                                foreach (var item in Model.SearchResults)
                                {
                                    <tr class="info">
                                        <td align="center">
                                            @Html.DisplayFor(modelItem => item.STT)
                                        </td>
                                        <td align="center">
                                            @Html.DisplayFor(modelItem => item.MONHOC_MA)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.MONHOC_TEN)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => (item.MONHOC_VBPL))
                                        </td>
                                        <td>
                                            @{

                                    if (item.MONHOC_ACTIVE == "1")
                                    {
                                        @Html.Raw("Hiệu lực")
                                    }
                                    else
                                    {
                                        @Html.Raw("Không hiệu lực")
                                    }
                                            }
                                        </td>
                                        <td align="center">

                                            <a href="@Url.Action("Detail", "GPS_MonHoc", new { id = item.MONHOC_MA })" data-modal="">
                                                <img src="@Url.Content("~/fonts/grid-view-icon.png")" title="Xem chi tiết môn học" />
                                            </a>
                                            @if (ViewBag.checkuser == "40")
                                            {
                                                <a href="@Url.Action("Edit", "GPS_MonHoc", new { id = item.MONHOC_MA })">
                                                    <img src="@Url.Content("~/fonts/grid-edit-icon.png")" title="Sửa Môn Học" />
                                                </a>
                                                <a href="@Url.Action("Delete", "GPS_MonHoc", new { id = item.MONHOC_MA})" onclick="return confirm('Bạn Thật Sự Muốn Xóa Môn Học Này!!!')">
                                                    <img src="@Url.Content("~/fonts/grid-delete-icon1.gif")" title="Hủy Môn Học" />
                                                </a>
                                            }
                                        </td>
                                    </tr>
                                }
                            }
                        }

                    </table>
                </div>

                <div class="pagination-sm row" style="clear:both; padding: 5px 0;">
                    @Html.PagedListPager(Model.SearchResults, page => Url.Action("Index", new
   {
       page,
       Model.mMONHOC_MA,
       Model.mMONHOC_TEN,
       Model.mMONHOC_ACTIVE
   }))
                </div>
            </fieldset>

        </div>
    </div>
</div>


<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/modalform")
}

